package factory;
//工厂模式
public class StudentBuilder
{
    private String _name;
    private int _age = 14;      // this has a default
    private String _sex = ""; //man woman
 
    public StudentBuilder() { }
 
    public Student buildStudent()
    {
        return new Student(_name, _age, _sex);
    }
 
    public StudentBuilder name(String _name)
    {
        this._name = _name;
        return this;
    }
 
    public StudentBuilder age(int _age)
    {
        this._age = _age;
        return this;
    }
 
    public StudentBuilder sex(String _sex)
    {
        this._sex = _sex;
        return this;
    }
}

